package org.jetlinks.pro.cassandra.metadata;

import org.hswebframework.ezorm.core.param.TermType;
import org.hswebframework.ezorm.rdb.metadata.RDBSchemaMetadata;
import org.hswebframework.ezorm.rdb.metadata.RDBTableMetadata;

public class CassandraSchema extends RDBSchemaMetadata {
    public CassandraSchema(String name) {
        super(name);

        addFeature(new CassandraCreateTableSqlBuilder());
        addFeature(new CassandraAlterTableSqlBuilder());
        addFeature(new CassandraQuerySqlBuilder(this));
        addFeature(new CassandraTableMetadataParser(this));
        addFeature(new BetweenAndTermFragmentBuilder(TermType.btw,"between",false));
        addFeature(new BetweenAndTermFragmentBuilder(TermType.nbtw,"not between",false));
    }

    @Override
    public RDBTableMetadata newTable(String name) {
        RDBTableMetadata metadata= super.newTable(name);
        metadata.addFeature(new CassandraQueryTermsFragmentBuilder(metadata));
        metadata.addFeature(new CassandraSelectColumnFragmentBuilder(metadata));
        return metadata;
    }
}
